package com.zhq.blog.core.domain.game.support;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.zhq.blog.core.domain.BaseRepository;

/**
 * @title:PermutationBetDetailRepository.java
 * @package com.zhq.blog.core.domain.game.support
 * @author 张恒强
 * @date 2014年12月26日 下午4:03:07
 * @version V1.0
 */
public interface PermutationBetDetailRepository extends JpaRepository<PermutationBetDetail,Long>,
				BaseRepository<PermutationBetDetail>,JpaSpecificationExecutor<PermutationBetDetail>{
	
	@Query("select pd from PermutationBetDetail pd where pd.deleted = 0 and pd.permutationBetId = :pid order by pd.betNumber asc")
	List<PermutationBetDetail> find_by_permutation(@Param("pid") long pid);
	
	@Query("select pd from PermutationBetDetail pd where pd.deleted = 0 and pd.permutationBetId = :pid and pd.betNumber = :betnumber")
	List<PermutationBetDetail> find_by_permutation_betnumber(@Param("pid") long pid,@Param("betnumber") int betnumber);
	
	@Query("select distinct pd.permutationBetId from PermutationBetDetail pd where pd.deleted = 0 and pd.cathecticModelId = :modelId")
	List<Long> find_by_modelId(@Param("modelId")long modelId);
}
